import wx
import os

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

class DiaDonate(wx.Dialog):
    def __init__(self, parent):
        super().__init__(parent, -1, '捐助窗口', style=wx.DIALOG_NO_PARENT)
        mainsizer = wx.BoxSizer(wx.VERTICAL)

        bmp = wx.Image(os.path.join(BASE_DIR, 'image/QR/QR.bmp')).ConvertToBitmap()
        b = wx.StaticBitmap(self, -1, bitmap=bmp)
        b.Bind(wx.EVT_LEFT_DOWN, self.OnClick)

        mainsizer.Add(b, 0, flag=wx.ALL|wx.EXPAND, border=0)
        self.SetSizer(mainsizer)
        mainsizer.Fit(self)
        mainsizer.SetSizeHints(self)
        self.Centre()

    def OnClick(self, event):
        self.Destroy()

if __name__ == "__main__":
    class MyFrame(wx.Frame):
        def __init__(self):
            super().__init__(None, -1, 'haha', size=(200, 100))
            btn = wx.Button(self, -1, 'baba', size=(10, 10))
            self.Bind(wx.EVT_BUTTON, self.OnClick, btn)

        def OnClick(self, event):
            # modal = DiaTable2add(self, 'baba').ShowModal()
            dia = DiaDonate(self)
            modal = dia.ShowModal()
            print(modal)
            dia.Destroy()

    app = wx.App()
    MyFrame().Show()
    app.MainLoop()